/* 
 * @moduleName: TransFormCascaderUtil.js
 * @Desc: 级联选择器
 * @Author: djkloop 
 * @Date: 2017-11-30 13:32:15 
 * @Last Modified by: djkloop
 * @Last Modified time: 2017-12-12 02:19:42
 */

 import React from 'react'
 import {Cascader} from 'antd';
 import colUtil from './ColWrapperUtil'

 export default {
  transformCascader(field, type) {
    let _rules = field.dateRules && type === 'single' ? field.dateRules.rules : [];
    return colUtil.colWrapper((getFieldDecorator,forUpdate) => getFieldDecorator(field.key, {rules:_rules,initialValue: forUpdate ? undefined : field.defaultValue})(
      <Cascader options={field.options} expandTrigger="hover" placeholder={field.placeholder || '请选择'} size="default"/>
    ), field);
  },
 }

